package com.nwcl.ysx.service.impl;

import com.nwcl.common.utils.BeanUtil;
import com.nwcl.ysx.bo.CuisineBO;
import com.nwcl.ysx.dao.CuisineDao;
import com.nwcl.ysx.entity.Cuisine;
import com.nwcl.ysx.service.CuisineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.Collections;
import java.util.List;

/**
 * @author liguiqin
 * @date 2023/5/29
 */
@Service
public class CuisineServiceImpl implements CuisineService {
    @Autowired
    private CuisineDao cuisineDao;

    @Override
    public List<CuisineBO> listByRestaurantId(Integer restaurantId) {
        List<Cuisine> cuisines = cuisineDao.listByRestaurantId(restaurantId);
        if (CollectionUtils.isEmpty(cuisines)) {
            return Collections.emptyList();
        }
        return BeanUtil.copyList(cuisines, CuisineBO.class);
    }
}
